var ID_CHAR_SET = {
    number: "0123456789",
    letter: "abcdefghijklmnopqrstuvwxyz",
    special: "~`!@#$%^&*()-_+=[]{};:\"',<.>/?"
}
var charNb = ID_CHAR_SET.number
  , charLower = ID_CHAR_SET.letter
  , charUpper = charLower.toUpperCase()
  , charSpecial = ID_CHAR_SET.special;
function isStr$2(st) {
    return typeof st == "string"
}
function isBol(st) {
    return typeof st == "boolean"
}
function isArr(st) {
    return st instanceof Array
}
function isNum$3(st, dt) {
    var Et = typeof st == "number";
    return dt ? Et : Et && !Number.isNaN(st) && Number.isFinite(st)
}
function unique(st, dt) {
    var Et = isStr$2(st);
    Et && (st = st.split("")),
    isArr(st) || (st = []);
    for (var St = st.slice(), wt = -1; ++wt < St.length; )
        for (var xt = wt, kt = function() {
            var Wt = St[wt]
              , zt = St[xt]
              , Xt = isArr(dt)
              , Qt = !Xt && (dt ? Wt == zt : Wt === zt) || Xt && dt.some(function(Zt) {
                return Wt && zt && !isUdf(Wt[Zt]) && Wt[Zt] === zt[Zt]
            });
            Qt && St.splice(xt--, 1)
        }; ++xt < St.length; )
            kt();
    return Et ? St.join("") : St
}
function randomNum(st, dt, Et) {
    var St = Math.random();
    if (!isNum$3(st))
        return St;
    isBol(dt) && (Et = dt);
    var wt;
    return !isNum$3(dt) || dt === st ? wt = St * st : wt = St * (dt - st) + st,
    Et ? wt : Math.floor(wt)
}
export function randomId(st, dt) {
    isStr$2(st) && (dt = st),
    isNum$3(st) || (st = 12);
    var Et = "";
    !dt || !isStr$2(dt) ? Et = charNb + charUpper : dt === "[*]" ? Et = charNb + charLower + charUpper + charSpecial : dt.match(/0-9|a-z|A-Z|\[s\]/) ? (/0-9/.test(dt) && (Et += charNb),
    /a-z/.test(dt) && (Et += charLower),
    /A-Z/.test(dt) && (Et += charUpper),
    /\[s\]/.test(dt) && (Et += charSpecial),
    Et += unique(dt.replace(/0-9|a-z|A-Z|\[s\]/g, ""))) : Et = dt;
    for (var St = "", wt = -1; ++wt < st; )
        St += Et[randomNum(Et.length)];
    return St
}